Release 10.1A: OpenEdge Development:
ADM and SmartObjects
Transactions and record locking
The transaction logic built into the standard SmartObjects (in particular, the SmartDataObject and its supporting files
data.iand the super proceduredata.p) uses optimistic locking. No database records are locked when they are initially read and transferred into the RowObject temp-table. When an update is committed, the corresponding database records are re-read with anEXCLUSIVE-LOCK. If a lock conflict occurs, the commit is aborted and this information is reported to the user. In the case of an add or copy operation, the recordCREATEfor the new record is performed inside of this transaction block.Next, by default, the SmartDataObject verifies that the database records were not modified by another user since they were first read. If you want to skip this check, set the
checkCurrentModifiedproperty in the SmartDataObject toNOin the instance properties dialog box for the SmartDataObject when assembling an application. Alternately, you can set it toNOin the initialization code for the SmartDataObject.Finally, only those fields actually modified by the application are
ASSIGNed back to the database records. Because the code uses theChangedFieldsfield in the update temp-table (RowObjUpd) to keep track of which fields were changed, it is necessary to update this field by hand if user-written application code is used; for example, if theRowObjectValidateprocedure in a SmartDataObject modified fields beyond those changed in a SmartDataViewer or SmartDataBrowser.When the update is complete, the database records are re-read to capture any field values that might have been assigned by the
CREATE,WRITE, orASSIGNtriggers, and those values are passed back to the client objects for display. A transaction is never held open while data values are examined or entered.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |